#ifndef SXNUTILS_H
#define SXNUTILS_H

#include<stdio.h>
#include<string.h>

#define SXN_PACKET_LEN 14  // Length of the command packet including start code, checksum, CR and LF
#define MAX_SXN_RESP_PACKET_LEN 68  // Maximum length of the response packet (REQ response with 4 heads)

#ifdef __cplusplus
extern "C"
#endif
char* sxn_compose_packet(const char* packet_body, char* packet, size_t dst_size);

#ifdef __cplusplus
extern "C"
#endif
int sxn_conv_cmd_104t_104n(const char* packet_t, char* packet_n);

#ifdef __cplusplus
extern "C"
#endif
int sxn_conv_cmd_104t_154nh(const char* packet_t, char *packet_n);

#ifdef __cplusplus
extern "C"
#endif
int sxn_conv_cmd_104n_154nh(const char* packet_t, char *packet_n);

#ifdef __cplusplus
extern "C"
#endif
int sxn_conv_rsp_req_154nh_104n(const char *resp_buffer, char *packet_n);

#ifdef __cplusplus
extern "C"
#endif
char calc_checksum(const char *packet_body);

#ifdef __cplusplus
extern "C"
#endif
void get_packet_body(const char* src, char* dst, size_t dst_size);

#ifdef __cplusplus
extern "C"
#endif
int validate_packet(const char *packet);


#endif
